/*
 * chunk.h
 *
 *  Created on: Mar 2, 2013
 *      Author: redchen
 */

#ifndef CHUNK_H_
#define CHUNK_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <lfs.h>
#include <vector.h>
#include <store_file.h>

typedef struct _Chunk_ Chunk;

Chunk* chunk_create(const char* path, int64_t id, const char* filename, int32_t size);

Chunk* chunk_load(const char* path, int64_t id);

int chunk_append(Chunk* chunk, void* data, int32_t size);

int chunk_read(Chunk* chunk, int64_t start, int64_t end, /*out:Vector<BFile>*/Vector* bfiles);

//

int32_t chunk_get_free_size(Chunk* chunk);

int32_t chunk_get_status(Chunk* chunk);

void chunk_set_status(Chunk* chunk, int32_t status);

#ifdef __cplusplus
}
#endif

#endif /* CHUNK_H_ */
